import os

from utils.ExcelUtil import Excel

basedir = os.path.abspath(os.path.dirname(__file__))

def testcase_path():
    return os.path.join(basedir, 'testcases.xlsx')


class DataLoader:
    def __init__(self):
        file = testcase_path()
        self._data = Excel(file).data

    @property
    def data(self):
        return self._data


def testcases(module,submodule=None):
    data = DataLoader().data
    sheet_name = module.split(".")[-1][5:]
    if submodule:
        return data[sheet_name][submodule]
    else:
        return data[sheet_name]


